/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mygameframework.sprite;

import com.mygameframework.isoengine.Direction;
import com.mygameframework.isoengine.TileEngine;
import com.mygameframework.scenes.CommonScene;
import com.mygameframework.states.IState;
import java.awt.Point;

/**
 *
 * @author bill
 */
public enum  SpriteState implements IState<AbstractSprite> {
    
    SpriteState_IDLE{
        
    },
   SpriteState_StartMove{

        ;

        @Override
        public void enter(AbstractSprite sprite) {
            this.engine= sprite.getScene().getTileEngine();
            this.scene=sprite.getScene();
            this.isBasedMapScaleLayering=scene.isBasedMapScaleLayering();
            
        }

        @Override
        public void execute(AbstractSprite sprite, long elapsedTime) {
            switch (sprite.getDirection()) {
                case NORTH:
                case NORTHEAST:
                case NORTHWEST:
                case WEST:
                    if(!isBasedMapScaleLayering){//tile级渲染
                        Point destination=engine.getWalker().tileWalk(sprite.getMapPoint(), sprite.getDirection());
                        sprite.getMapPoint().setLocation(destination);
                        
                    }else{//map级渲染
                        
                    }
                    break;
                default:
                    throw new AssertionError();
            }
        }

        @Override
        public void exit(AbstractSprite entity) {
            
        }
        
    },
   SpriteState_DoMove{

        ;

        @Override
        public void enter(AbstractSprite entity) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void execute(AbstractSprite entity, long elapsedTime) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void exit(AbstractSprite entity) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
        
    },
   SpriteState_DoneMove{

        ;

        @Override
        public void enter(AbstractSprite entity) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void execute(AbstractSprite entity, long elapsedTime) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void exit(AbstractSprite entity) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
        
    }
    ;

        @Override
        public void enter(AbstractSprite entity) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void execute(AbstractSprite entity, long elapsedTime) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void exit(AbstractSprite entity) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }
        
        TileEngine engine;
        CommonScene scene;
        boolean  isBasedMapScaleLayering;
}
